<?php
	session_start();
	mysql_connect("localhost", "sapmenet_admin", "a1s2d3f4g5h6j7") or die ("Problem with datebase");
	mysql_select_db("sapmenet_users");
	
	$idd=$_SESSION['id'];

	$publication = "SELECT publications.text, publications.date, publications.numberOfLikes, users.ID, users.FirstName, users.LastName, publications.publisherID,  publications.numberOfDislikes, publications.ID FROM publications JOIN users ON publications.publisherID=users.ID WHERE publications.seen = 0 AND publications.userID = {$idd} order by publications.ID desc";
	$publication= mysql_query($publication);
	if(mysql_num_rows($publication)>0)
	{
		while($thePublication = mysql_fetch_array($publication, MYSQL_NUM))
		{
			echo ("<br>");
			echo ("<div class='publication' id='".$thePublication[8]."'><span class='publisher'><a href='http://sapme.net/Framework/profilePage.php?id=".$thePublication['6']."'>".$thePublication['4']." ".$thePublication['5'].":</a><img src='Icons/close.png' class='deletePub' id='".$thePublication[8]."'></span><br><p id='parPub'>".$thePublication[0]."</p>  <br><span id='date'>Date: ". $thePublication['1']." </span> &nbsp;&nbsp;<img src = 'like.png' class = 'likeButton' id = '".$thePublication['8']."' style = 'cursor:pointer' title = 'Like this'> Likes: ". $thePublication['2']."&nbsp;&nbsp;&nbsp; <img src = 'dislike.png' class = 'DislikeButton' id = '".$thePublication['8']."' style = 'cursor:pointer' title = 'Dislike this'> Dislikes: ".$thePublication['7']."<span class = 'showPublicationCommentsButton' id = '".$thePublication[8]."'>Comments</span>");                                                                 
			echo ("</div>");			
		}
	}
	else
	{
		echo("HUI");
	}
?>